"""
1.获取当前时间 localtime() struct_time
2.获取时分秒 不断的对秒进行加1 time.sleep(1)
3.判断 s = 60 m +1 s=0 m=60 h+1 m=0
"""
import time
lt = time.localtime()
hour = lt.tm_hour # 获取小时
minute = lt.tm_min # 获取分钟
second = lt.tm_sec # 获取秒
while True:
    time.sleep(1)
    second+=1
    if second==60:
        minute+=1
        second=0
        if minute==60:
            hour+=1
            minute=0
            if hour==24:
                hour=0
                minute=0
                second=0
    print(f"{hour:02d}:{minute:02d}:{second:02d}")  # 填充如果不足两位就往前面填充0